package com.ysh.smartplatform.mapper;

import com.ysh.smartplatform.dto.R;
import com.ysh.smartplatform.pojo.Role;
import com.ysh.smartplatform.pojo.RoleExample;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 袁胜虎 on 2022/9/16 17:11
 */
public interface RoleMapper {
    @Select("select * from sys_role")
    List<Role> findAllRoles();

    List<Role> selectByExample(RoleExample example);

    @Delete("delete from sys_role where role_id = #{roleId}")
    void DeleteById(Long Id);

    @Select("select * from sys_role where role_name = #{roleName}")
    Role selectByName(String name);

    @Insert("insert into sys_role(role_id,role_name,role_key,remark) values (#{roleId},#{roleName},#{roleKey},#{remark})")
    void insertRole(Role role);

    @Update("update sys_role set role_name = #{roleName}, role_key = #{roleKey} ,remark = #{remark} where role_id = #{roleId}")
    void updateRole(Role role);
}
